package com.dodi.spring.jdbc.firstDemo;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringJDBCTest {

	public static void main(String[] args) {

		ApplicationContext act = new ClassPathXmlApplicationContext("jdbc/firstDemo/applicationContext.xml");
		
		UserService userService = (UserService) act.getBean("userService");
		
		User user = new User();
		
		user.setName("lance");
		user.setAge(20);
		user.setSex("男");
		
		//userService.save(user);
		
/*		List<User> users = userService.getUsers();
		
		System.out.println("--------得到所有user");
		
		for (User user2 : users) {
			System.out.println(user2.getId()+"  "+user2.getName()+"  "+user2.getAge()+"  "+user2.getSex());
		}*/
		
		Object object = userService.queryForObjectTest();
		
		System.out.println(object);
		
	}

}
